package com.ltd.testviewgroup;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;


public class ScrollerActivity extends Activity {

    @Bind(R.id.textView)
    TextView mTextView;
    @Bind(R.id.leftButton)
    Button mLeftButton;
    @Bind(R.id.rightButton)
    Button mRightButon;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_scroller);
        ButterKnife.bind(this);
//        mLeftButton.setOnClickListener(this);
//        mRightButon.setOnClickListener(this);

    }

    @OnClick({R.id.leftButton,R.id.rightButton})
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.leftButton:
                //让mTextView的内容往左移
                mTextView.scrollBy(30, 0);
                //让mLeftButton的内容也往左移
                mLeftButton.scrollBy(20, 0);
                break;
            case R.id.rightButton:
                //让mTextView的内容往右移直接到-30的位置
                mTextView.scrollTo(-30, 0);
                break;
            default:
                break;
        }
    }
}
